package com.wanwu.channel.common.enums;

/**
 * @author zhy
 * @date 2020-1-4
 * @descrption 支付宝的错误码，交易状态码  枚举类
 */
public enum AlipayAppErrorCodeEnums {

    ILLEGAL_SIGN("ILLEGAL_SIGN", "签名不正确"),
    ILLEGAL_DYN_MD5_KEY("ILLEGAL_DYN_MD5_KEY", "动态密钥信息错误"),
    ILLEGAL_ENCRYPT("ILLEGAL_ENCRYPT", "加密不正确"),
    ILLEGAL_ARGUMENT("ILLEGAL_ARGUMENT", "参数不正确"),
    ILLEGAL_SERVICE("ILLEGAL_SERVICE", "接口名称不正确"),
    ILLEGAL_PARTNER("ILLEGAL_PARTNER", "合作伙伴ID不正确"),
    ILLEGAL_USER("ILLEGAL_USER", "用户ID不正确"),
    ILLEGAL_EXTERFACE("ILLEGAL_EXTERFACE", "接口配置不正确"),
    ILLEGAL_PARTNER_EXTERFACE("ILLEGAL_PARTNER_EXTERFACE", "合作伙伴接口信息不正确"),
    ILLEGAL_SECURITY_PROFILE("ILLEGAL_SECURITY_PROFILE", "未找到匹配的密钥配置"),
    ILLEGAL_AGENT("ILLEGAL_AGENT", "代理ID不正确"),
    ILLEGAL_SIGN_TYPE("ILLEGAL_SIGN_TYPE", "签名类型不正确"),
    ILLEGAL_CHARSET("ILLEGAL_CHARSET", "字符集不合法"),
    INVALID_CHARACTER_SET("INVALID_CHARACTER_SET", "字符集不正确"),
    ILLEGAL_CLIENT_IP("ILLEGAL_CLIENT_IP", "客户端IP地址无权访问服务"),
    ILLEGAL_DIGEST_TYPE("ILLEGAL_DIGEST_TYPE", "摘要类型不正确"),
    ILLEGAL_DIGEST("ILLEGAL_DIGEST", "文件摘要不正确"),
    ILLEGAL_FILE_FORMAT("ILLEGAL_FILE_FORMAT", "文件格式不正确"),
    ILLEGAL_ENCODING("ILLEGAL_ENCODING", "不支持该编码类型"),
    ILLEGAL_REQUEST_REFERER("ILLEGAL_REQUEST_REFERER", "防钓鱼检查不支持该请求来源"),
    ILLEGAL_ANTI_PHISHING_KEY("ILLEGAL_ANTI_PHISHING_KEY", "防钓鱼检查非法时间戳参数"),
    ANTI_PHISHING_KEY_TIMEOUT("ANTI_PHISHING_KEY_TIMEOUT", "防钓鱼检查时间戳超时"),
    ILLEGAL_EXTER_INVOKE_IP("ILLEGAL_EXTER_INVOKE_IP", "防钓鱼检查非法调用IP"),
    ILLEGAL_NUMBER_FORMAT("ILLEGAL_NUMBER_FORMAT", "数字格式不合法"),
    ILLEGAL_INTEGER_FORMAT("ILLEGAL_INTEGER_FORMAT", "Int类型格式不合法"),
    ILLEGAL_MONEY_FORMAT("ILLEGAL_MONEY_FORMAT", "金额格式不合法"),
    ILLEGAL_DATA_FORMAT("ILLEGAL_DATA_FORMAT", "日期格式错误"),
    REGEXP_MATCH_FAIL("REGEXP_MATCH_FAIL", "正则表达式匹配失败"),
    ILLEGAL_LENGTH("ILLEGAL_LENGTH", "参数值长度不合法"),
    PARAMTER_IS_NULL("PARAMTER_IS_NULL", "参数值为空"),
    HAS_NO_PRIVILEGE("HAS_NO_PRIVILEGE", "无权访问"),
    SYSTEM_ERROR("SYSTEM_ERROR", "支付宝系统错误"),
    SESSION_TIMEOUT("SESSION_TIMEOUT", "session超时"),
    ILLEGAL_TARGET_SERVICE("ILLEGAL_TARGET_SERVICE", "错误的target_service"),
    ILLEGAL_ACCESS_SWITCH_SYSTEM("ILLEGAL_ACCESS_SWITCH_SYSTEM", "partner不允许访问该类型的系统"),
    ILLEGAL_SWITCH_SYSTEM("ILLEGAL_SWITCH_SYSTEM", "切换系统异常"),
    EXTERFACE_IS_CLOSED("EXTERFACE_IS_CLOSED", "接口已关闭"),
    REFUNDMENT_VALID_DATE_EXCEED("REFUNDMENT_VALID_DATE_EXCEED", "超过退款周期 不能退款"),
    SYSTEM_EXCEPTION("SYSTEM_EXCEPTION", "系统异常"),
    REPEATED_REFUNDMENT_REQUEST("REPEATED_REFUNDMENT_REQUEST", "重复退款请求"),
    RETURN_AMOUNT_EXCEED("RETURN_AMOUNT_EXCEED", "退款金额超过支付金额"),
    CURRENCY_NOT_SAME("CURRENCY_NOT_SAME", "退款币种与支付币种不一致"),
    PURCHASE_TRADE_NOT_EXIST("PURCHASE_TRADE_NOT_EXIST", "交易不存在"),
    BUYER_NOT_EXIST("BUYER_NOT_EXIST", "买家不存在"),
    REFUND_CHARGE_ERROR("REFUND_CHARGE_ERROR", "支付进行中，退款失败。请稍后重试。"),
    MORE_THAN_ALLOW_REFUND_FOREX_FEE("MORE_THAN_ALLOW_REFUND_FOREX_FEE", "超过可退付汇金额"),
    TRADE_NOT_EXIST("TRADE_NOT_EXIST", "交易不存在"),


    ;

    private String code;
    private String desc;

    AlipayAppErrorCodeEnums(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static AlipayAppErrorCodeEnums getErrorCodeEnum(String code) {
        for (AlipayAppErrorCodeEnums v : AlipayAppErrorCodeEnums.values()) {
            if (code.equals(v.getCode())) {
                return v;
            }
        }
        return SYSTEM_EXCEPTION;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }


}
